package com.itheima.sys.controller;

import com.itheima.common.vo.Result;
import com.itheima.sys.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DepartmentController {

    @Autowired
    private IDepartmentService departmentService;

    /**
     * 根据员工id获得部门从低到高数组
     * @param companyUserId
     * @return
     */
    @GetMapping("/department/allId/{companyUserId}")
    Result<Long[]> queryDepartmentsByUserId(@PathVariable("companyUserId") Long companyUserId) {
        return Result.success(departmentService.queryDepartmentsByUserId(companyUserId));
    }
}
